package com.ph.irp.base.materialassistantattribute.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.ph.irp.base.materialassistantattribute.dao.AssistantAttributeTypeDao;
import com.ph.irp.base.materialassistantattribute.service.AssistantAttributeTypeService;
import com.ph.irp.model.PBaseMaterialAssistantattributetype;

/**
 * The Class AssistantAttributeTypeServiceImpl.
 * 
 * @author SongYandong song.yandong@phinfoservices.com
 * @version 1.0 <br>
 *          Copyright (C), 2009, SongYandong <br>
 *          This program is protected by copyright laws. <br>
 *          Program Name: AssistantAttributeTypeServiceImpl.java<br>
 *          Date:2009-11-17
 */
public class AssistantAttributeTypeServiceImpl implements
		AssistantAttributeTypeService {
	private AssistantAttributeTypeDao attributeTypeDaoProxy;

	public AssistantAttributeTypeDao getAttributeTypeDaoProxy() {
		return attributeTypeDaoProxy;
	}

	public void setAttributeTypeDaoProxy(
			AssistantAttributeTypeDao attributeTypeDaoProxy) {
		this.attributeTypeDaoProxy = attributeTypeDaoProxy;
	}

	/*
	 * 添加方法 返回0表示添加成功，返回1表示添加失败
	 */
	@Override
	public void addAttributeType(PBaseMaterialAssistantattributetype model)
			throws Throwable {
		attributeTypeDaoProxy.addAttributeType(model);
	}

	/*
	 * 删除方法 删除成功返回0，失败返回1
	 */
	@Override
	public void deleteAttributeType(Object[] id) throws Throwable {
		for (int i = 0; i < id.length; i++) {
			attributeTypeDaoProxy.deleteAttributeType(Integer
					.valueOf((String) id[i]));
		}
	}

	/*
	 * 多条件查询 返回一个list
	 */
	@Override
	public List<PBaseMaterialAssistantattributetype> getAllAttributeType(
			PBaseMaterialAssistantattributetype model) throws Throwable {
		return attributeTypeDaoProxy.getAllAttributeType(model);
	}

	/*
	 * 根据ID查询
	 */
	@Override
	public PBaseMaterialAssistantattributetype getAttributeTypeById(int id)
			throws Throwable {
		return attributeTypeDaoProxy.getAttrobuteTypeById(id);
	}

	/*
	 * 修改方法 修改成功返回0，失败返回1
	 */
	@Override
	public void updateAttributeType(PBaseMaterialAssistantattributetype model)
			throws Throwable {
		attributeTypeDaoProxy.updateAttributeType(model);

	}

	@Override
	public List<PBaseMaterialAssistantattributetype> getBasic(int basicType)
			throws Throwable {
		return attributeTypeDaoProxy.getAllAttributeType(basicType);
	}

}
